<template>
    <div class="card">
        <div class="title">
            <div class="title-body">
                <img :src="icon" class="title-icon" v-if="icon"/>
                <div class="required" v-if="stateType == 'Y'">*</div>
                <div :class="['title-text', isFlex1?'flex-1':'']" :style="'color:'+ titleColor">{{title}}</div>
                <div class="title-desc">{{desc}}</div>
            </div>
            <slot name="title"></slot>
        </div>
        <slot></slot>
    </div>
</template>

<script setup lang="ts">

defineProps({
    icon: String,
    titleColor: {
        default: '#2B9B37'
    },
    desc: String,
    stateType: String,
    isFlex1: Boolean,
    title: String,
})

</script>


<style scoped>
    .card{
        background: #FFFFFF;
        box-shadow: 0 0 16px 0 rgba(0,0,0,0.04);
        border-radius: 16px;
        margin-bottom: 24px;
    }
    .title{
        display: flex;
        align-items: center;
        padding: 34px 24px 40px 24px;
    }
    .title-body{
        flex: 1;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    }
    .title-icon{
        width: 30px;
        height: 30px;
        padding-right: 16px;
    }
    .title-text{
        font-size: 30px;
        color: #2B9B37;
        /* font-weight: 600; */
    }
    .title-desc{
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 28px;
        color: #999;
    }
    .flex-1{
        flex: 1;
    }
    .required {
        color: red;
        font-size: 26px;
        margin-right: 10px;
    }
</style>